#include <iostream>
#include <algorithm>
#include <string>
#include <cctype>
using namespace std;
string to_lower(string s)
{
	for(auto &e:s)
	{
		if(!islower(e))
		e=tolower(e);
	}
	return s;
}
int main()
{
    string s1,s2;
    cin >> s1 >> s2;
    if(s1.size() == s2.size())
    cout << "1" << endl;
    else if(s1 == s2)
    cout <<"2" << endl;
    else if(to_lower(s1) == to_lower(s2))
    cout << "3" << endl;
    else
    cout << "4" << endl;
	return 0;
}
